package com.example.spring_book.service;

import com.example.spring_book.dao.BookDao;
import com.example.spring_book.model.BookInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BookService {
    @Autowired
    private BookDao bookDao;
    public List<BookInfo>getBookInfoList(){

        List<BookInfo>bookInfos=bookDao.mockBookData();
        for(BookInfo bookInfo:bookInfos){
            if(bookInfo.getState().equals("1")){
                bookInfo.setStateCN("可借阅");
            }else if(bookInfo.getState().equals("2")){
                bookInfo.setStateCN("不可借阅");
            }
        }
        return bookInfos;
    }

}
